package com.wandian.admin.cmd;

import java.io.BufferedWriter;
import java.util.Map;

import com.wandian.command.AdminCmd;
import com.wandian.command.AdminCommand;
import com.wandian.command.CommandSet;

/**
 * @author long
 * @Create 2012-10-16 上午11:48:19
 * @QQ 108232706
 * @version 1.0
 * @description HelpAdminCmd
 */
@AdminCmd(code = "help", paramCounts = "1", desc = "server_name help")
public class HelpAdminCmd extends AbstractAdminCmd
{
	@Override
	public boolean exec(String[] params, BufferedWriter writer)
	{
		Map<String, AdminCommand> adminCommands = CommandSet.getAllAdminCommand();
		StringBuilder sb = new StringBuilder();
		for (AdminCommand adminCommand : adminCommands.values()) {
			AdminCmd adminCmd = adminCommand.getClass().getAnnotation(AdminCmd.class);
			sb.append(adminCmd.desc()).append("\r\n");
		}
		send(writer, sb.toString());
		return true;
	}
}